package it.polimi.swKnights.SWIMv2.ejb.searchEngine;

import it.polimi.swKnights.SWIMv2.ejb.entityBeans.RegisteredUser;

public class UserQueryResult implements Comparable<UserQueryResult>
{

	private RegisteredUser user;
	
	private ResultCategory resultCategory;
	
	private Integer ranking;
	
	private String ability;

	public String getUsername()
	{
		return this.getUser().getUserName();
	}

	public UserQueryResult(RegisteredUser user, ResultCategory resultCategory,
			Integer ranking, String ability)
	{
		this.user = user;
		this.resultCategory = resultCategory;
		this.ranking = ranking;
		this.setAbility(ability);
	}


	public RegisteredUser getUser()
	{
		return user;
	}

	public void setUser(RegisteredUser user)
	{
		this.user = user;
	}

	public ResultCategory getResultCategory()
	{
		return resultCategory;
	}

	public void setResultCategory(ResultCategory resultCategory)
	{
		this.resultCategory = resultCategory;
	}

	public Integer getRanking()
	{
		return ranking;
	}

	public void setRanking(Integer ranking)
	{
		this.ranking = ranking;
	}

	public boolean refersToSameUser(UserQueryResult otherUserQR)
	{
		return otherUserQR.user.getUserName().equals(this.user.getUserName());
	}

	@Override
	public int compareTo(UserQueryResult otherUserQR)
	{

		return this.ranking.compareTo(otherUserQR.ranking);
	}

	public String getAbility()
	{
		return ability;
	}

	public void setAbility(String ability)
	{
		this.ability = ability;
	}

}
